<?php
if(basename($_SERVER['SCRIPT_NAME']) != "barangbukti.php") {
	header("Location:../../barangbukti.php");
	die();
}

$pegawai = $_GET['detail'];

$detail = mysql_fetch_array(mysql_query("
	SELECT *
	FROM t_pegawai a
	LEFT JOIN r_jabatan b ON a.kd_jabatan=b.kd_jabatan
	LEFT JOIN r_pangkat c ON a.kd_pangkat=c.kd_pangkat
	WHERE a.kd_pegawai=".$pegawai
));

?>
<div class="da-panel">

<div class="da-panel-header">
	<span class="da-panel-title">
<i class="icon-user"></i> <strong><?php echo $detail['nm_lengkap'] ?></strong>
		</span>
	</div>
			<div class="da-panel-toolbar">
			<div class="btn-toolbar">
				<div class="btn-group">
					<button class="btn disabled">Profil</button>
					<a href="?detail=<?php echo $pegawai ?>&aktifitas" class="btn">Aktifitas</a>
					<a href="?detail=<?php echo $pegawai ?>&statistik" class="btn">Statistik</a>
					<a href="?detail=<?php echo $pegawai ?>&akses" class="btn">Hak Akses</a>
				</div>
			</div>
		</div>
	<div class="da-panel-content da-form-container">
	<form id="da-form-spdp" class="da-form" method="post" action="modul/pegawai/pegawai.proses.php">
		<table class="da-table da-detail-view no-border">
			<tbody>
				<tr>
					<th>NIP</th>
					<td><input type="text" placeholder="NIP" name="nip" value="<?php echo $detail['nip'] ?>"/></td>
				</tr>
				<tr>
					<th>Nama Lengkap</th>
					<td><input type="text" placeholder="Nama Lengkap" name="nama" value="<?php echo $detail['nm_lengkap'] ?>"/></td>
				</tr>
				<tr>
					<th>Jabatan</th>
					<td>
					<select name="jabatan">
						<option value="<?php echo $detail['kd_jabatan'] ?>"><?php echo $detail['nm_jabatan'] ?></option>
						<?php
							$q = mysql_query("SELECT * FROM r_jabatan");
							while($dt = mysql_fetch_array($q)) {
								if($dt['kd_jabatan'] < 6) {
									if(mysql_num_rows(mysql_query("
									SELECT * FROM t_pegawai WHERE kd_jabatan=".$dt['kd_jabatan']))==1) {
										continue;
									}
								}
						?>
						<option value="<?php  echo $dt['kd_jabatan'] ?>"><?php echo $dt['nm_jabatan'] ?></option>
						<?php } ?>
					</select>
					</td>
				</tr>
				<tr>
					<th>Pangkat</th>
					<td>
						<select name="pangkat">
						<option value="<?php echo $detail['kd_pangkat'] ?>"><?php echo $detail['nm_pangkat'] ?></option>
						<?php
							$q = mysql_query("SELECT kd_pangkat, nm_pangkat FROM r_pangkat WHERE jns_pangkat='jaksa'");
							while($dt = mysql_fetch_array($q)) {
						?>
						<option value="<?php  echo $dt['kd_pangkat'] ?>"><?php echo $dt['nm_pangkat'] ?></option>
						<?php } ?>
					</select>
					</td>
				</tr>
				<tr>
					<th valign="top">Alamat</th>
					<td><textarea name="alamat"><?php echo $detail['alamat'] ?></textarea></td>
				</tr>
				<tr>
					<th>No. Telepon</th>
					<td><input type="text" placeholder="Telepon" name="telepon" value="<?php echo $detail['no_telp'] ?>"/></td>
				</tr>
				<tr>
					<th>Handphone</th>
					<td><input type="text" placeholder="Handphone" name="handphone" value="<?php echo $detail['no_hp'] ?>"/></td>
				</tr>
			</tbody>
		</table>
		<fieldset class="da-form-inline">
			<legend>Akun</legend>
		</fieldset>
		<table class="da-table da-detail-view no-border">
			<tbody>
				<tr>
					<th>Nama Pengguna</th>
					<td><input type="text" placeholder="Nama Pengguna" name="username" value=""/></td>
				</tr>
				<tr>
					<th>Kata Sandi</th>
					<td><input type="password" placeholder="Kata Sandi" name="password" value=""/></td>
				</tr>
				<tr>
					<th>Ulangi Kata Sandi</th>
					<td><input type="password" placeholder="Ulangi Kata Sandi" name="password2" value=""/></td>
				</tr>
			</tbody>
		</table>
		<div class="btn-row">
			<button id="ubah-spdp" class="btn"><i class="icol-disk"></i> Simpan</button></legend>
			<input type="hidden" name="pegawai" value="ubah" />
			<input type="hidden" name="kd_pegawai" value="<?php echo $pegawai ?>" />
		</div>
	</form>
</div>

</div>
